﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace OpenQuarters.WebQuarters.Core
{
    public partial class WorkflowComment : CMSEntity<WorkflowComment, long>
    {
        [Newtonsoft.Json.JsonProperty]
        public long json_WorkflowCommentId
        {
            get { return this.WorkflowCommentId; }
        }

        [Newtonsoft.Json.JsonProperty]
        public long json_WorkflowItemId
        {
            get { return this.WorkflowItemId; }
        }

        [Newtonsoft.Json.JsonProperty]
        public string json_UserId
        {
            get { return this.UserId; }
        }

        [Newtonsoft.Json.JsonProperty]
        public string json_DateCreated
        {
            get { return this.DateCreated.ToString("f"); }
        }

        [Newtonsoft.Json.JsonProperty]
        public string json_Comment
        {
            get { return this.Comment; }
        }

        public override System.Linq.Expressions.Expression<Func<WorkflowComment, bool>> GetIDSelector(long ID)
        {
            return e => e.WorkflowCommentId == ID;
        }

        public override long GetKey(WorkflowComment Entity)
        {
            return Entity.WorkflowCommentId;
        }

        public override void OnSaving()
        {
            base.OnSaving();

            this.LoggingMode = LoggingMode.Off;
            this.DateCreated = DateTime.UtcNow;
        }
    }
}
